package com.xiaoyin.community.Controller;

import com.xiaoyin.community.Domain.BookInfo;
import com.xiaoyin.community.Service.BookInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * Created by yinjianping@baidu.com on 2018/7/13.
 *
 * @Description:
 * @Modified By:
 */
@RestController
public class BookInfoController {
    @Autowired
    private BookInfoService bookInfoService;

    @RequestMapping(value = "/savebook",method = RequestMethod.GET)
    public void saveController(){
        BookInfo bookInfo = new BookInfo();
        bookInfo.setTitle("java");
        bookInfo.setAuthor("小尹");
        bookInfo.setUrl("http://baidu.com");
        bookInfo.setTags("计算机");
        bookInfo.setTime(new Date());
        bookInfoService.insert(bookInfo);
    }
    @RequestMapping(value = "/find",method = RequestMethod.GET)
    public List<BookInfo> findController(){
        return bookInfoService.findService();
    }
}
